package com.rjpacket.supernews.app.models;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by Administrator on 2015/3/12 0012.
 */
public class Recycle {
    private String title;
    private String thumb;


    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public boolean isCollect() {
        return collect;
    }

    public void setCollect(boolean collect) {
        this.collect = collect;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    private boolean collect;
    private String time;

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    private List<String> list;

    public void parseJson(JSONObject json) {
        if (json != null) {
            list = new LinkedList<String>();
            try {
                title = json.getString("title");

                thumb = json.getString("thumb");

                collect = json.getBoolean("collect");

                time = json.getString("time");

                JSONArray jsonArray = json.getJSONArray("singleImg");

                for (int j = 0; j < jsonArray.length(); j++) {

                    JSONObject js = jsonArray.getJSONObject(j);

                    String url = js.getString("sourceUrl");

                    list.add(url);
                }


            } catch (JSONException e) {

                e.printStackTrace();
            }
        }
    }

}
